/**
 * @author Fang Lu, fanglupku@gmail.com
 * 2011-4-13
 */
package dao.entity;

import code.extract.SegmentItem;

public class SegmentEntity {
	public static final int CODE_SEGMENT = 1;
	public static final int NON_CODE_SEGMENT = 0;
	public static final int SPAM_SEGMENT = 2;
	private int id;
	private int api_id;
	private int page_id;
	private int type;
	private int index;
	private String begin_tag;
	private String end_tag;
	private String content;
	private String relevant;
	public SegmentEntity(int id, int api_id, int page_id, int type,
			int index, String begin_tag, String end_tag,
			String content, String relevant){
		this.id = id;
		this.api_id = api_id;
		this.page_id = page_id;
		this.type = type;
		this.index = index;
		this.begin_tag = begin_tag;
		this.end_tag = end_tag;
		this.content = content;
		this.relevant = relevant;
	}
	public SegmentEntity(SegmentItem item){
		this.id = 0;
		this.api_id = 0;
		this.page_id = 0;
		this.relevant = "";
		if (item.isCodeSegment() == true){
			this.type = CODE_SEGMENT;
		}else if (item.isSpamSegment() == true){
			this.type = SPAM_SEGMENT;
		}else{
			this.type = NON_CODE_SEGMENT;
		}
		this.index = item.getIndex();
		this.content = item.getContent();
		this.begin_tag = item.getBeginTag();
		this.end_tag = item.getEndTag();
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getApi_id() {
		return api_id;
	}
	public void setApi_id(int apiId) {
		api_id = apiId;
	}
	public int getPage_id() {
		return page_id;
	}
	public void setPage_id(int pageId) {
		page_id = pageId;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	public String getBegin_tag() {
		return begin_tag;
	}
	public void setBegin_tag(String beginTag) {
		begin_tag = beginTag;
	}
	public String getEnd_tag() {
		return end_tag;
	}
	public void setEnd_tag(String endTag) {
		end_tag = endTag;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getRelevant() {
		return relevant;
	}
	public void setRelevant(String relevant) {
		this.relevant = relevant;
	}
	
}
